package com.xgpro.mapper.archives;

import com.xgpro.domain.archives.entity.*;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface ExcelImportMapper {


    @Insert("<script>" +
            " insert into t_performance(user_id,per_time,introduce,perdept,create_time) values " +
            "<foreach collection='list' item='per' index='index' separator=',' >" +
            "  (#{per.userId},#{per.perTime},#{per.introduce},#{per.perdept},#{per.createTime})" +
            "</foreach>" +
            "</script>")
    Integer insertPer(@Param("list") List<PerForMance> list);

    @Delete("<script>" +
            " delete from t_performance where" +
            " user_id=#{id} and create_time=#{time}" +
            "</script>")
    Integer deletePer(@Param("id") Integer id,@Param("time")String time);


    @Insert("<script>" +
            " insert into t_job_title(major_type,certificate_time,valid_time,license,user_id) values " +
            "<foreach collection='list' item='title' index='index' separator=',' >" +
            "  (#{title.majorType},#{title.certificateTime},#{title.validTime},#{title.license},#{title.userId})" +
            "</foreach>" +
            "</script>")
    Integer insertTitle(@Param("list") List<JobTitle> list);

    @Delete("<script>" +
            " delete from t_job_title where" +
            " user_id=#{id}" +
            "</script>")
    Integer deleteTitle(@Param("id") Integer id);


    @Insert("<script>" +
            " insert into t_project(project_name,project_level,project_post,project_introduce," +
            " project_achievement,project_number,project_starttime,project_endtime,user_id) values " +
            "<foreach collection='list' item='project' index='index' separator=','>" +
            "  (#{project.projectName},#{project.projectLevel},#{project.projectPost},#{project.projectIntroduce},#{project.projectAchievement}," +
            "    #{project.projectNumber},#{project.projectStarttime},#{project.projectEndtime},#{project.userId})" +
            "</foreach>" +
            "</script>")
    Integer insertProject(@Param("list") List<Project> list);

    @Insert("<script>" +
            " insert into t_patent(name,license_time,user_id,patent_type,patent_number,patent_post," +
            "  patent_person) values " +
            "<foreach collection='list' item='patent' index='index' separator=','>" +
            "  (#{patent.name},#{patent.licenseTime},#{patent.userId},#{patent.patentType}," +
            "    #{patent.patentNumber},#{patent.patentPost},#{patent.patentPerson})" +
            "</foreach>" +
            "</script>")
    Integer insertPatent(@Param("list") List<Patent> list);


    @Insert("<script>" +
            " insert into t_six_sigma(six_sigma_grade,acquisition_time,certificate_number,user_id) values " +
            "<foreach collection='list' item='sigma' index='index' separator=','>" +
            "  (#{sigma.sixSigmaGrade},#{sigma.acquisitionTime},#{sigma.certificateNumber},#{sigma.userId})" +
            "</foreach>" +
            "</script>")
    Integer insertSixSigma(@Param("list") List<SixSigma> list);

    @Delete("<script>" +
            " delete from t_six_sigma where" +
            " user_id=#{id}" +
            "</script>")
    Integer deleteSixSigma(@Param("id") Integer id);
}
